package com.swt.gap.service.impl;

import com.swt.gap.dao.CustomStyleDao;
import com.swt.gap.model.entity.CustomStyle;
import com.swt.gap.service.CustomStyleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * created by lanshengyuan on 2019/9/19
 * @author lanshengyuan
 */
@Service
public class CustomStyleServiceImpl implements CustomStyleService {
    private final CustomStyleDao customStyleDao;

    public CustomStyleServiceImpl(CustomStyleDao customStyleDao) {
        this.customStyleDao = customStyleDao;
    }

    @Override
    public int addCustomStyle(CustomStyle customStyle) {
        return customStyleDao.insertSelective(customStyle);
    }

    @Override
    public int deleteCustomStyle(int id) {
        CustomStyle record = new CustomStyle();
        record.setId(id);
        record.setDeleted(1);
        return customStyleDao.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateCustomStyle(CustomStyle customStyle) {
        return customStyleDao.updateByPrimaryKeySelective(customStyle);
    }

    @Override
    public CustomStyle select(int id) {
        return customStyleDao.selectByPrimaryKey(id);
    }

    @Override
    public List<CustomStyle> listCustomStyle() {
        return customStyleDao.selectAllCustomStyle();
    }
}
